package main.model.island;

import java.awt.Color;
import java.awt.Polygon;

import main.demonutils.IslandTime;
import main.model.critters.genetics.CritterLocation;


@Deprecated
public class Token {
	private Color skin;
	private CritterLocation currentLocation;
	private CritterLocation aimLocation;
	private Polygon shape;
	
	private int health = 1000; //Goes down if hungry or attacked
	private IslandTime age = new IslandTime(0);
	private boolean fertile = false; //Maturity is reached if Age=>Life/6
    private boolean alive = true; //false if dead
    private int death;
	
	private int requiredVeg, vegEaten;
	private int requiredMeat, meatEaten;
	private int requiredFood;
	private int dietMax;
	
	/**
	 * a death age between life*5 and life*7 with a standard dis
	 * @param degree
	 */
	/*private void setDeath(int degree){
		int life = critter.getMorphology().getLifespan();
		death = life*5;
		Random random = new Random();
		int count = 0;
		for(int i =0; i<degree;i++){
			count = count + random.nextInt(life*2);
		}
		death = death + (count/degree);
	}*/
	
	public void kill(){alive=false;}
	
	public IslandTime getAge() {return age;}
	public void progressAge() {age.addMinutes(1);}
	/*public void ageCheck(){
		if(age.getWeeks() > critter.getMorphology().getLifespan()){
			fertile = true;
		}
		if(age.getWeeks() > death){
			alive = false;
		}
	}*/
	
	
	public void eatVeg(int food){
		vegEaten = vegEaten + food;
	}
	
	public void eatMeat(int food){
		meatEaten = meatEaten + food;
	}
	
	public int hungerMeat(){
		if(meatEaten<requiredMeat){
			return requiredMeat-meatEaten;
		}else{
			return requiredFood - (meatEaten + vegEaten);
		}
	}
	
	public int hungerVeg(){
		if(vegEaten<requiredVeg){
			return requiredVeg-vegEaten;
		}else{
			return requiredFood - (meatEaten + vegEaten);
		}
	}
	
	/*public void setDiet(){
		int diet;
		if(critter == null){
			diet = 50;
		}else{
			diet = critter.getMorphology().getDiet();
		}
		
		dietMax = new Gene(GeneType.DIET).getGeneMax();
		
		if(diet<dietMax/5){
			requiredVeg = requiredFood;
			requiredMeat=0;
		}else if(diet<(dietMax/5)*2){
			requiredVeg = requiredFood - ((requiredFood/(dietMax/5)) * (diet-(dietMax/5)*2));
			requiredMeat = 0;
		}else if(diet<(dietMax/5)*3){
			requiredVeg = 0;
			requiredMeat = 0;
		}else if(diet<(dietMax/5)*4){
			requiredMeat = ((requiredFood/(dietMax/5)) * (diet-(dietMax/5)*4));
			requiredVeg = 0;
		}else{
			requiredMeat = requiredFood;
			requiredVeg = 0;
		}
		
	}*/

	
	
	
	/*public Token(Critter critter){
		skin = ColorGenerator.getSkinColor();
		this.setCritter(critter);
		currentLocation = new Location(0,0);
		setDiet();
		setDeath(30);
	}
	
	public Color getSkin() {
		return skin;
	}
	public void setSkin(Color skin) {
		this.skin = skin;
	}
	public Location getCurrentLocation() {
		return currentLocation;
	}
	public void setCurrentLocation(Location currentLocation) {
		this.currentLocation = currentLocation;
	}*/

	/**
	 * @return the aimLocation
	 */
	/*public Location getAimLocation() {
		return aimLocation;
	}

	/**
	 * @param aimLocation the aimLocation to set
	 */
	/*public void setAimLocation(Location aimLocation) {
		this.aimLocation = aimLocation;
	}

	/**
	 * @return the shape
	 */
	public Polygon getShape() {
		return shape;
	}

	/**
	 * @param shape the shape to set
	 */
	public void setShape(Polygon shape) {
		this.shape = shape;
	}

	/**
	 * @return the critter
	 */
	/*public Critter getCritter() {
		return critter;
	}

	/**
	 * @param critter the critter to set
	 */
	/*public void setCritter(Critter critter) {
		this.critter = critter;
	}*/
}
